<template>
  <div class="custom-form">
    <el-row :gutter="15">
      <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"
        :key="showFormKey">
        <!-- 物品清单 -->
        <el-col :span="24">
          <el-form-item label-width="0" prop="field100b1d0">
            <h2 align='center' style="color:undefined;font-size: nullpx;text-align: center">物品清单</h2>
          </el-form-item>
        </el-col>
        <!-- 角色id -->
        <el-col :span="24" v-if="hasFormPermission('RoleId')" v-show="showFlag">
          <el-form-item :label="$t('角色id')" prop="RoleId">
            <el-input v-model="formData['RoleId']" placeholder="请输入角色id"
              :disabled="hasDisabledPermission('RoleId',false)"
              :readonly="!hasEditPermission('RoleId',true)" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <!-- 角色名称 -->
        <el-col :span="24" v-if="hasFormPermission('RoleName')" v-show="showFlag">
          <el-form-item :label="$t('角色名称')" prop="RoleName">
            <el-input v-model="formData['RoleName']" placeholder="请输入角色名称"
              :disabled="hasDisabledPermission('RoleName',false)"
              :readonly="!hasEditPermission('RoleName',true)" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <!-- 职级名称 -->
        <el-col :span="24" v-if="hasFormPermission('F_Job')" v-show="showFlag">
          <el-form-item :label="$t('职级名称')" prop="F_Job">
            <el-input v-model="formData['F_Job']" placeholder="请输入职级名称"
              :disabled="hasDisabledPermission('F_Job',false)"
              :readonly="!hasEditPermission('F_Job',true)" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <!-- 地区 -->
        <el-col :span="24" v-if="hasFormPermission('F_Area')" v-show="showFlag">
          <el-form-item :label="$t('地区')" prop="F_Area">
            <el-input v-model="formData['F_Area']" placeholder="请输入地区"
              :disabled="hasDisabledPermission('F_Area',false)"
              :readonly="!hasEditPermission('F_Area',true)" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <!-- 申请人id -->
        <el-col :span="24" v-if="hasFormPermission('F_UserId')" v-show="showFlag">
          <el-form-item :label="$t('申请人id')" prop="F_UserId">
            <el-input v-model="formData['F_UserId']" placeholder="请输入申请人id"
              :disabled="hasDisabledPermission('F_UserId',false)"
              :readonly="!hasEditPermission('F_UserId',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 申请人名称 -->
        <el-col :span="24" v-if="hasFormPermission('F_UserName')">
          <el-form-item :label="$t('申请人名称')" prop="F_UserName">
            <el-input v-model="formData['F_UserName']" placeholder="请输入申请人名称"
              :disabled="hasDisabledPermission('F_UserName',false)"
              :readonly="true" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 申请时间 -->
        <el-col :span="24" v-if="hasFormPermission('F_Create_Time')" v-show="showFlag">
          <el-form-item :label="$t('申请时间')" prop="F_Create_Time">
            <el-input v-model="formData['F_Create_Time']" placeholder="请输入申请时间"
              :disabled="hasDisabledPermission('F_Create_Time',false)"
              :readonly="!hasEditPermission('F_Create_Time',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 部门名称 -->
        <el-col :span="24" v-if="hasFormPermission('F_DepartmentName')" v-show="showFlag">
          <el-form-item :label="$t('部门名称')" prop="F_DepartmentName">
            <el-input v-model="formData['F_DepartmentName']" placeholder="请输入部门名称"
              :disabled="hasDisabledPermission('F_DepartmentName',false)"
              :readonly="!hasEditPermission('F_DepartmentName',false)" clearable
              :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
        <!-- 部门id -->
        <el-col :span="24" v-if="hasFormPermission('F_DepartmentId')">
          <el-form-item :label="$t('部门')" prop="F_DepartmentId">
            <el-select v-model="formData['F_DepartmentId']" placeholder="请选择部门id"
              @change="Handleselect"
              :disabled="hasDisabledPermission('F_DepartmentId',false)" filterable clearable
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in F_DepartmentData" :key="index" :label="item.F_FullName"
                :value="item.F_DepartmentId" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 采购日期 -->
        <el-col :span="24" v-if="hasFormPermission('F_BuyDate')">
          <el-form-item :label="$t('采购日期')" prop="F_BuyDate">
            <el-date-picker :disabled="hasDisabledPermission('F_BuyDate',false)"
              :readonly="!hasEditPermission('F_BuyDate',false)" v-model="formData['F_BuyDate']"
              format="yyyy-MM-dd" value-format="yyyy-MM-dd" :style="{width: '100%'}" placeholder="请选择采购日期"
              clearable></el-date-picker>
          </el-form-item>
        </el-col>
        <!-- 名称 -->
        <el-col :span="24" v-if="hasFormPermission('F_Name')">
          <el-form-item :label="$t('名称')" prop="F_Name">
            <el-input v-model="formData['F_Name']" placeholder="请输入名称"
              :disabled="hasDisabledPermission('F_Name',false)"
              :readonly="!hasEditPermission('F_Name',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 数量 -->
        <el-col :span="24" v-if="hasFormPermission('F_Counts')">
          <el-form-item :label="$t('数量')" prop="F_Counts">
            <el-input v-model.number="formData['F_Counts']" type="number" placeholder="请输入数量"
              :disabled="hasDisabledPermission('F_Counts',false)"
              :readonly="!hasEditPermission('F_Counts',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 单价 -->
        <el-col :span="24" v-if="hasFormPermission('F_Price')">
          <el-form-item :label="$t('单价')" prop="F_Price">
            <el-input v-model="formData['F_Price']" type="number" placeholder="请输入单价" :maxlength="2"
              :disabled="hasDisabledPermission('F_Price',false)"
              :readonly="!hasEditPermission('F_Price',false)" clearable :style="{width: '100%'}">
              <template slot="append">CNY</template>
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 购买渠道 -->
        <el-col :span="24" v-if="hasFormPermission('F_Source')">
          <el-form-item :label="$t('购买渠道')" prop="F_Source">
            <el-select v-model="formData['F_Source']" placeholder="请选择购买渠道"
              :disabled="hasDisabledPermission('F_Source',false)" filterable clearable
              :style="{width: '100%'}">
              <el-option v-for="(item, index) in F_SourceOptions" :key="index" :label="item.F_ItemName"
                :value="item.F_ItemValue" :disabled="item.disabled"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <!-- 是否生效 -->
        <el-col :span="24" v-if="hasFormPermission('F_IsEffective')" v-show="showFlag">
          <el-form-item :label="$t('是否生效')" prop="F_IsEffective">
            <el-input v-model="formData['F_IsEffective']" placeholder="请输入是否生效"
              :disabled="hasDisabledPermission('F_IsEffective',false)"
              :readonly="!hasEditPermission('F_IsEffective',false)" clearable :style="{width: '100%'}">
            </el-input>
          </el-form-item>
        </el-col>
        <!-- 意见簿 -->
        <el-col :span="24" v-if="hasWorkFlowFormPermission('field1161ee0')" v-show="optionsFlag">
          <el-form-item :label="$t('意见簿')" prop="field1161ee0">
            <xjr-opinion-comonent :value="formData.field1161ee0"></xjr-opinion-comonent>
          </el-form-item>
        </el-col>
        <el-col :span="24" v-if="!isWorkflowForm">
          <el-form-item size="large" v-if="isEdit">
            <el-button type="primary" @click="submitForm" :loading="submitLoading">
              {{submitLoading?$t('workFlow.WFMenu.hintSubmit'):$t('submit')}}</el-button>
            <el-button @click="cancelForm">{{$t('cancelText')}}</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>
<script>

  import FilterableDataList from '@/components/generator/clientComponents/FilterableDataList.vue';
  import workflowFormAuthorize from "@/mixins/workflowFormAuthorize";
  import authorizeMixin from "@/mixins/authorize";
  import { baseUrl } from "@/config/env";
  import request from "@/router/axios";
  import {getLeaveTime,getUserDetailsById} from '@/api/user.js';
  export default {
    mixins: [authorizeMixin,workflowFormAuthorize],
  components: {},
  props: ['keyValue', 'isEdit', 'disabled'],
  data() {
    var checkCount = (rule, value, callback) => {
        if (!value) {
          return callback(new Error('不能小于0'));
        }
        setTimeout(() => {
          if (!Number.isInteger(value)) {
            callback();
          } else { 
            if (value < 0) {
              callback(new Error('不能小于0'));
            } else {
              callback();
            }
          }
        }, 1000);
      };
    let _this = this
    return {
      submitLoading: false,
      showForm: true,
      showFormKey: 1,
      reRenderSubform: false,
      operationVal: 'add',
      isAdd: true,
      addressUrl:'purchaselist',
      mainTableName: 'oa_purchase_list',
      formConfig: {},
      formData: {
        'field100b1d0': '',
        'RoleId': '',
        'RoleName': '',
        'F_Job': '',
        'F_Area': '',
        'F_UserId': '',
        'F_UserName': '',
        'F_Create_Time': '2022-12-22',
        'F_DepartmentName': '',
        'F_DepartmentId': '',
        'F_BuyDate': null,
        'F_Name': '',
        'F_Counts': 1,
        'F_Price': "",
        'F_Source': '',
        'F_IsEffective': "0",
        'field1161ee0': null,
      },
      rules: {
        RoleId: [],
        RoleName: [],
        F_Job: [],
        F_Area: [],
        F_UserId: [{
          required: true,
          message: '请输入申请人id',
          trigger: 'blur'
        }],
        F_UserName: [{
          required: true,
          message: '请输入申请人名称',
          trigger: 'blur'
        }],
        F_Create_Time: [],
        F_DepartmentName: [{
          required: false,
          message: '请输入部门名称',
          trigger: 'blur'
        }],
        F_DepartmentId: [{
          required: true,
          message: '请选择部门id',
          trigger: 'change'
        }],
        F_BuyDate: [{
          required: true,
          message: '请选择采购日期',
          trigger: 'change'
        }],
        F_Name: [{
          required: true,
          message: '请输入名称',
          trigger: 'blur'
        }],
        F_Counts: [
          {
            required: true,
            validator: checkCount,
            trigger: 'blur'
          }
        ],
        F_Price: [{
          required: true,
          message: '请输入单价',
          trigger: 'blur'
        }],
        F_Source: [{
          required: true,
          message: '请选择购买渠道',
          trigger: 'change'
        }],
        F_IsEffective: [],
      },
      F_DepartmentData: [],
      F_RoleData:[],
      F_SourceOptions: [],
      showFlag:false
    }
  },
  computed: {},
  watch: {
    'formData.F_Counts': function(val, oldVal) {
      this.changeFormConfigDefaultValue();
    },
    'formData.F_Price': function(val, oldVal) {
      this.changeFormConfigDefaultValue();
    },
  },
  created() {
    this.formConfig = this.getFormConfig();
  },
  async mounted() {
    //TODO   再这里做数据回填 请求表单数据
    if(this.keyValue){
        this.isAdd = false;
    }
    if(!this.isAdd&&this.keyValue){
        this.operationVal = 'edit';
        try {
          let res = await request({
            url: baseUrl + "/"+this.addressUrl+"/" + this.keyValue,
            method: "get",
          });
          this.formData = res.data.data
          this.showFormKey++;
        } catch (error) {}
    }
    if (typeof this.getF_SourceOptions == "function") {
      await this.getF_SourceOptions();
    }
    this.getUserInfo()
  },
  methods: {
    getUserInfo(){
      //判断部门有没有数据
      let params
      if(this.formData.F_UserId){
        params = {
          userId:this.formData.F_UserId
        }
      }else{
        params = {
          userId:this.$store.state.user.userInfo.F_UserId
        }
      }
      getUserDetailsById(params).then(res => {
        if(res && res.data && res.data.success){
          this.F_DepartmentData = res.data.data.F_Department
          this.F_RoleData = res.data.data.F_Role
          //赋值申请人信息
          this.formData['F_UserName'] =  res.data.data.F_RealName
          this.formData['F_UserId'] =  res.data.data.F_UserId
          this.formData['F_Area'] = res.data.data.F_Area
          this.formData['F_Job'] = res.data.data.F_Job
          this.initRoleData()
          this.initDepartmentData()
         }
      })
    },
    initDepartmentData(){
        if(this.F_DepartmentData && this.F_DepartmentData.length == 1){
          this.formData['F_DepartmentName'] = this.F_DepartmentData[0].F_FullName
          this.formData['F_DepartmentId'] = this.F_DepartmentData[0].F_DepartmentId
        }
      },
    initRoleData(){
      let roleId = []
      let roleName = []
      if(this.F_RoleData && this.F_RoleData.length > 0){
        this.F_RoleData.forEach(e => {
          roleId.push(e.F_RoleId)
          roleName.push(e.F_FullName)
        })
      }
      this.formData['RoleId'] = roleId.join(',')
      this.formData['RoleName'] = roleName.join(',')

    },
     Handleselect(){
      console.log(this.F_DepartmentData)
      if(this.F_DepartmentData && this.F_DepartmentData.length > 0){
        this.F_DepartmentData.forEach(e => {
          if(e.F_DepartmentId == this.formData['F_DepartmentId']){
            this.formData['F_DepartmentName'] = e.F_ShortName
          }
        })
      }
    },
    getFormData() {
      let key = this.mainTableName + 'Entity';
      let returnParams = {};
      returnParams[key] = this.formData;
      return {
        ...returnParams,
      };
    },
    validateForm() {
      this.$refs['elForm'].validate(valid => {});
    },
    async aysncValidateForm() {
      let validataArry = []
      validataArry.push(new Promise((resolve, reject) => {
        this.$refs['elForm'].validate(valid => {
          resolve(valid)
        })
      }))
      let res = await Promise.all(validataArry)
      if (res.includes(false)) {
        return false
      }
      else {
        return true;
      }
    },
    changeTableData() {},
    async submitForm() {
      this.submitLoading = true;
      let valid = await this.aysncValidateForm();
      if (valid == false) {
        this.submitLoading = false;
        return false;
      }
      this.changeTableData();
      //格式化数据
      let newObj = this.getFormData();
      
        //如果没有传入参数就是新增
        if (!this.keyValue) {

          request({
            url: baseUrl + "/"+this.addressUrl,
            method: "post",
            data : newObj
          }).then((res) => {
            this.submitLoading = false;
            this.$notify({
              title: "成功",
              message: "新增成功",
              type: "success",
            });
             this.$emit("onChange",true)
          });

        }
        else{

         request({
            url: baseUrl + "/"+this.addressUrl+"/" + this.keyValue,
            method: "put",
            data : newObj
          }).then((res) => {
            this.submitLoading = false;
            this.$notify({
              title: "成功",
              message: "修改成功",
              type: "success",
            });
             this.$emit("onChange",true)
          });

        }
       
       
      
    },
    cancelForm() {
      this.$emit("onChange", true)
    },
    formatTree(data, valueField, lableField, childField, type) {
      let tree = [];
      data.forEach((node, index) => {
        let newNode = {
          value: node[valueField],
          label: node[lableField],
        };
        if (type) {
          newNode.disabled = node[valueField] == undefined ? true : false
        }
        tree.push(newNode);
        if (node[childField] != null && node[childField].length > 0) {
          newNode.children = (this.formatTree(node[childField], valueField, lableField, childField,
          type));
        }
      }, this);
      return tree;
    },
    //辅助工作流 审批(编辑) 预留方法
    handleEdit() {
    },
    getNumberFixed2(number) {
      let splitNum = ("" + number).replace(/(^0*)/g, "").split(".");
      let num = splitNum[0] == "" ? '0' : splitNum[0];
      if (splitNum.length > 1) {
        num += '.';
        let roundNum = 2; //保留两位小数
        for (let i = 0; i < roundNum; i++) {
          num += splitNum[1][i];
        }
      }
      return parseFloat(num);
    },
    changeFormConfigDefaultValue() {
      let valueForFormIdMap = new Map();
      this.formConfig.fields.forEach((ele) => {
        if (ele.__config__.componentName == "table") {
          ele.__config__.children.forEach((element) => {
            valueForFormIdMap.set(ele.__config__.formId + "-table-" + element.__config__.formId,
              element.__config__.defaultValue);
          });
        }
        else if (ele.__config__.componentName && ele.__config__.componentName == 'avue-tabs') {
          let childrenObj = ele.__config__.childrenObj || {};
          let _arr = this.getValByTabs(childrenObj);
          _arr.map(item => {
            valueForFormIdMap.set(item.formId, item.defaultValue);
          });
        }
        else {
          valueForFormIdMap.set(ele.__config__.formId, this.formData[ele.__vModel__]);
        }
      });
      this.formConfig.fields.forEach((ele, index) => {
        if (ele.__config__.componentName == "table") {
          ele.__config__.children.forEach((element, childrenIndex) => {
            let defaultValue = 0;
            if (element.computationalConfiguration && element.computationalConfiguration.length > 0) {
              let formulaStr = "";
              element.computationalConfiguration.forEach((item) => {
                if (item.type == "taxRate") {
                  //税率
                  if (element.taxRate >= 0) {
                    formulaStr += element.taxRate * 0.01;
                  }
                }
                else {
                  let eleValue = valueForFormIdMap.get(item.formId) || 0;
                  formulaStr += item.formId == 0 ? item.name : eleValue;
                }
              });
              defaultValue = eval(formulaStr);
              defaultValue = this.getNumberFixed2(defaultValue);
              //大写
              if (element.isCapitalized) {
                this.formConfig.fields[index].__config__.children[childrenIndex].__config__
                  .capitalizedValue = this.getCapitalizedMethod(defaultValue);
              }
              this.formConfig.fields[index].__config__.children[childrenIndex].__config__
                .defaultValue = defaultValue;
              this.formData[element.__vModel__] = defaultValue;
            }
          });
        }
        else if (ele.__config__.componentName && ele.__config__.componentName == 'avue-tabs') {
          let childrenObj = ele.__config__.childrenObj || {};
          //avue-tabs
          this.calcDefaultValueByTabs(ele.__config__.childrenObj, valueForFormIdMap);
        }
        else {
          let defaultValue = 0;
          if (ele.computationalConfiguration && ele.computationalConfiguration.length > 0) {
            let formulaStr = "";
            ele.computationalConfiguration.forEach((item) => {
              if (item.type == "taxRate") {
                //税率
                if (ele.taxRate >= 0) {
                  formulaStr += ele.taxRate * 0.01;
                }
              }
              else {
                let eleValue = valueForFormIdMap.get(item.formId) || 0;
                formulaStr += item.formId == 0 ? item.name : eleValue;
              }
            });
            defaultValue = eval(formulaStr);
            defaultValue = this.getNumberFixed2(defaultValue);
            //大写
            if (ele.isCapitalized) {
              this.formConfig.fields[index].__config__.capitalizedValue = this.getCapitalizedMethod(
                defaultValue);
            }
            this.formConfig.fields[index].__config__.defaultValue = defaultValue;
            this.formData[ele.__vModel__] = defaultValue;
          }
        }
      });
    },
    getValByTabs(childrenObj) {
      let _arr = [];
      if (!childrenObj || !(childrenObj instanceof Object)) return [];
      for (let key in childrenObj) {
        let children = childrenObj[key];
        children.map(item => {
          if (item.__config__.componentName && item.__config__.componentName == 'avue-tabs') {
            let cObj = item.__config__.childrenObj || {};
            _arr.push(...this.getValByTabs(item.__config__.childrenObj));
          }
          else {
            let _obj = {};
            _obj.formId = item.__config__.formId;
            _obj.defaultValue = this.formData[item.__vModel__];
            _arr.push(_obj);
          }
        });
      }
      return (() => {
        return _arr;
      })()
    },
    calcDefaultValueByTabs(childrenObj, valueForFormIdMap) {
      if (!childrenObj || !(childrenObj instanceof Object)) return;
      for (let key in childrenObj) {
        let children = childrenObj[key];
        children.map(item => {
          if (item.__config__.componentName && item.__config__.componentName == 'avue-tabs') {
            let cObj = item.__config__.childrenObj || {};
            this.calcDefaultValueByTabs(cObj, valueForFormIdMap);
          }
          else {
            let defaultValue = 0;
            if (item.computationalConfiguration && item.computationalConfiguration.length > 0) {
              let formulaStr = "";
              item.computationalConfiguration.forEach((c) => {
                if (item.type == "taxRate") {
                  //税率
                  if (item.taxRate >= 0) {
                    formulaStr += item.taxRate * 0.01;
                  }
                }
                else {
                  let eleValue = valueForFormIdMap.get(c.formId) || 0;
                  formulaStr += c.formId == 0 ? c.name : eleValue;
                }
              });
              defaultValue = eval(formulaStr);
              defaultValue = this.getNumberFixed2(defaultValue);
              item.__config__.defaultValue = defaultValue;
              this.formData[item.__vModel__] = defaultValue;
            }
          }
        });
      }
    },
    async getF_SourceOptions() {
      // 注意：this.$axios是通过Vue.prototype.$axios = axios挂载产生的
      try {
        let resp = await this.$axios({
          method: 'get',
          url:  baseUrl + '/data-items/buysource/detail',
        });
        if (resp.data.data) {
          this.F_SourceOptions = resp.data.data;
        }
      }
      catch (error) {}
    },
    //子表单权限
    getAuthorityTableChildrenList(bindTable, children) {
      let column = [];
      if (bindTable && this.formEnCodeList && this.formEnCodeList[bindTable]) {
        let formSubEnCodeList = this.formEnCodeList[bindTable];
        if (children && children.length > 0) {
          column = children.map(ele2 => {
            if (formSubEnCodeList.includes(ele2.prop)) {
              ele2.hide = false;
            }
            else {
              ele2.hide = true;
            }
            if (ele2.hide == false) {
              //工作流中系统表单必填权限
              if (this.formSubTableNotRequiredList[bindTable] != undefined) {
                if (this.formSubTableNotRequiredList[bindTable].includes(ele2.prop)) {
                  ele2.required = false;
                }
                else {
                  ele2.required = true;
                }
              }
              ele2.rules = [];
              if (ele2.required) {
                ele2.rules = ele2.ruleList;
              }
              // disabled 属性
              if (this.formSubTableDisabledList[bindTable] != undefined) {
                if (this.formSubTableDisabledList[bindTable].includes(ele2.prop)) {
                  ele2.disabled = true;
                }
                else {
                  ele2.disabled = false;
                }
              }
            }
            return ele2;
          });
        }
        return column;
      }
      else {
        return children;
      }
    },
    getFormConfig() {
      let config = {
        "fields": [{
          "__vModel__": "field100b1d0",
          "__config__": {
            "label": "采购申请",
            "showLabel": false,
            "titleColor": null,
            "fontSize": null,
            "tag": "h2",
            "span": 24,
            "align": "top",
            "justify": "start",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 100
          }
        }, {
          "__vModel__": "RoleId",
          "__config__": {
            "label": "角色id",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 101,
            "fieldLength": 500,
            "bindTable": "oa_purchase_list",
            "bindTableField": "RoleId",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "RoleName",
          "__config__": {
            "label": "角色名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 102,
            "fieldLength": 500,
            "bindTable": "oa_purchase_list",
            "bindTableField": "RoleName",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Job",
          "__config__": {
            "label": "职级名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 103,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_Job",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Area",
          "__config__": {
            "label": "地区",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 104,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_Area",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_UserId",
          "__config__": {
            "label": "申请人id",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 105,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_UserId",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_UserName",
          "__config__": {
            "label": "申请人名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 106,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_UserName",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Create_Time",
          "__config__": {
            "label": "申请时间",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 107,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_Create_Time",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_DepartmentName",
          "__config__": {
            "label": "部门名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 108,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_DepartmentName",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_DepartmentId",
          "__config__": {
            "label": "部门id",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 109,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_DepartmentId",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "date",
          "__vModel__": "F_BuyDate",
          "__config__": {
            "label": "采购日期",
            "tag": "el-date-picker",
            "avueType": "datetime",
            "defaultValue": null,
            "showLabel": true,
            "span": 24,
            "required": true,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 110,
            "fieldLength": "50",
            "bindTableFieldType": "datetime",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_BuyDate"
          }
        }, {
          "__vModel__": "F_Name",
          "__config__": {
            "label": "名称",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 111,
            "fieldLength": "50",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_Name",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "number",
          "__vModel__": "F_Counts",
          "computationalConfiguration": [],
          "__config__": {
            "label": "数量",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input",
            "defaultValue": 0,
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "formId": 112,
            "fieldLength": "10",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_Counts",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "number",
          "__vModel__": "F_Price",
          "computationalConfiguration": [],
          "append": "CNY",
          "__config__": {
            "label": "单价",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input",
            "defaultValue": "",
            "required": true,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 113,
            "fieldLength": "10",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_Price",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_Source",
          "__config__": {
            "label": "购买渠道",
            "showLabel": true,
            "tag": "el-select",
            "avueType": "select",
            "span": 24,
            "required": true,
            "saveField": "",
            "showField": "",
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 114,
            "dataType": "dataItem",
            "dataItem": "buysource",
            "fieldLength": "10",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_Source",
            "bindTableFieldType": "varchar"
          }
        }, {
          "__vModel__": "F_IsEffective",
          "__config__": {
            "label": "是否生效",
            "showLabel": true,
            "tag": "el-input",
            "avueType": "input-tip",
            "defaultValue": "0",
            "required": false,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 115,
            "fieldLength": "10",
            "bindTable": "oa_purchase_list",
            "bindTableField": "F_IsEffective",
            "bindTableFieldType": "varchar"
          }
        }, {
          "tempType": "textarea",
          "__vModel__": "field1161ee0",
          "__type__": "opinion",
          "__config__": {
            "label": "意见簿",
            "showLabel": true,
            "tag": "xjr-opinion-comonent",
            "defaultValue": null,
            "span": 24,
            "F_LgMarkCode": "",
            "prestrainField": "",
            "formId": 116
          }
        }]
      };
      return config;
    },
  }
}

</script>
<style>
.el-table__empty-block {
  width: 100% !important;
}

.avue-form__row {
  padding: 0 !important;
}

#editorphone {
  width: 375px;
  margin: 0 auto;
  border: 1px solid #E4E7ED;
  padding: 0 7.5px;
  background: #f5f6fa;
  height: 700px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 5px;
}

#editorphone .el-col {
  border-bottom: 1px solid #F2F2F2;
  background: #fff;
  margin-bottom: 0;
  padding: 0 15px 6px !important;
  width: 100%;
}

#editorphone .el-form-item__label {
  line-height: 20px
}

#editorphone .el-input-group .el-input__inner {
  background: #f5f6fa
}

#editorphone .el-input__inner {
  border: 0
}

#editorphone .el-input-group__append,
#editorphone .el-input-group__prepend {
  border: 0;
  background: #edeef2;
  color: #666;
}

#editorphone .el-input-group .el-input__prefix {
  left: 44px
}

#editorphone .el-input-group .el-input__suffix {
  right: 44px
}

#editorphone .el-form-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-flow: wrap;
}

#editorphone .el-form-item__label {
  float: none;
  min-width: 85px;
  width: auto !important;
  text-align: left;
  flex: auto;
}

#editorphone .tinymce .el-form-item__label {
  min-width: 100%;
}

#editorphone .el-form-item__content {
  margin-left: 0px !important;
  flex: auto;
  width: calc(100% - 95px);
}

#editorphone .avueFormNoLable .el-form-item__label,
#editorphone .avueFormNoLable .avue-crud__pagination {
  display: none;
}

#editorphone .avueFormNoLable .el-collapse-item__wrap,
#editorphone .avueFormNoLable .el-collapse {
  border-bottom: 0
}

#editorphone .avueFormNoLable .el-col {
  border-bottom: 0;
  padding-bottom: 0
}

#editorphone .el-form-item__content .el-button:first-child {
  margin-left: 90px;
}

</style>


